package com.xiegang.servicepassengeruser.controller;

import com.xiegang.internalcommon.dto.ResponseResult;
import com.xiegang.internalcommon.request.VerificationCodeDto;
import com.xiegang.servicepassengeruser.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author xieGang
 * @description
 * @date 2023/3/2 19:29
 **/
@RestController
public class UserController {


    @Autowired
    private UserService userService;

    @PostMapping("/user")
    public ResponseResult loginOrRegister(@RequestBody VerificationCodeDto verificationCodeDto){

        String passengerPhone = verificationCodeDto.getPassengerPhone();

        System.out.println("手机号："+passengerPhone);
        return userService.loginOrRegister(passengerPhone);
    }

    @GetMapping("/user/{phone}")
    public ResponseResult getUserByPhone(@PathVariable("phone") String passengerPhone){
        return userService.getUserByPhone(passengerPhone);
    }


}
